import request from '@/api/request'


export function fetchUserList(params) {
    return request({
        url: '/api/user/page',
        method: 'get',
        params
    })
}

export function getUserDetail(id) {
    return request({
        url: `/api/user/${id}`,
        method: 'get'
    })
}

export function getCurrentUser() {
    return request({
        url: `/api/user/getCurrentUser`,
        method: 'get'
    })
}

export function createUser(data) {
    return request({
        url: '/api/user',
        method: 'post',
        data
    })
}

export function updateUser(data) {
    return request({
        url: `/api/user`,
        method: 'put',
        data
    })
}

export function deleteUser(id) {
    return request({
        url: `/api/user/${id}`,
        method: 'delete'
    })
}

export function changePassword(data) {
    return request({
        url: `/api/user/changePassword`,
        method: 'post',
        data
    })
}
